<template>
	<sw-common-frame :loading="loading">
		<template slot="button">
			<el-button type="primary" size="small" icon="el-icon-plus" @click="handleOpenDialog()">新增</el-button>
		</template>
		<el-form slot="query" size="small" inline>
			<el-form-item>
				<el-input placeholder="请输入角色名称" v-model="queryData.name" clearable></el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" icon="el-icon-search" @click="queryTableData()">搜索</el-button>
			</el-form-item>
		</el-form>
		<template slot="table">
			<el-table size="medium" :data="tableData" stripe height="100%">
				<el-table-column prop="name" label="名称"></el-table-column>
				<el-table-column prop="createName" label="创建人"></el-table-column>
				<el-table-column prop="content" label="描述"></el-table-column>
				<el-table-column prop="createTime" label="创建时间" width="160"></el-table-column>
				<el-table-column label="操作" width="90">
					<template slot-scope="{ row }">
						<el-button size="medium" type="text" @click="handleOpenDialog(row.id)">编辑</el-button>
						<el-button size="medium" type="text" @click="handleDeleteData(row)">删除</el-button>
					</template>
				</el-table-column>
			</el-table>
		</template>
		<template slot="page">
			<sw-pagination :total="dataCount" :page.sync="queryData.page" :limit.sync="queryData.limit" @change="queryTableData()"></sw-pagination>
		</template>
		<form-dialog v-model="formDialog" :data-id="dataId" @refresh="queryTableData()"></form-dialog>
	</sw-common-frame>
</template>

<script>
import formDialog from './form';
import listMixins from '@/mixins/listMixins';
import { getLibraryRolePageList, deleteLibraryRole } from '@/api/platform/tbRoleDefinition';
export default {
	mixins: [listMixins],
	components: { formDialog },
	data() {
		return {
			pageName: '库角色'
		};
	},
	computed: {
		listFunction() {
			return eval(getLibraryRolePageList);
		},
		deleteFunction() {
			return eval(deleteLibraryRole);
		}
	},
	methods: {}
};
</script>
<style lang="scss" scoped>
.library_role_box {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 16px;
	overflow: hidden;
}
</style>
